<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/lotSplit.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();
 String userTypeChiptrac = Constants.USER_TYPE_CHIPTRAC + ""; %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js"></script>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script language="javascript">
var listSize = 0;
window.onload = init;
function init()
{
    if ( document.lotSplitform.processStepId  != null)
    {
        qs_1 = new QuickSearch(document.lotSplitform.processStepId, document.lotSplitform.qs1, false);
    }

    if ( document.lotSplitform.lotId  != null)
    {
        qs_2 = new QuickSearch(document.lotSplitform.lotId, document.lotSplitform.qs2, false);
    }
}

function selectProcessType()
{ 
   var form = document.lotSplitform;

   if( form.processType.value == '0' )
   {
        form.action.value = 'processTypes';
        form.submit();
        return;
   }
   if( form.processStepId != null )
   {
	    form.processStepId.value='0';
   }
   if ( form.locationId != null )
   {
       form.locationId.value = 0;
   }
   if ( form.lotId != null )
   {
       form.lotId.value = 0;
   }
   form.action.value="partNumbers";
   form.submit();
}

function finalSave()
{
    var form = document.lotSplitform;
	var pa=document.getElementById("message");
	pa.innerHTML = '';
    var count1                  = 0;

    if ( form.baseprocessType.value.toUpperCase() == 'DIE BANK' || form.baseprocessType.value.toUpperCase() == 'Assembly'.toUpperCase() || form.baseprocessType.value.toUpperCase() == 'Test'.toUpperCase()
                || form.baseprocessType.value.toUpperCase() == 'Class Store'.toUpperCase() || form.baseprocessType.value.toUpperCase() == 'Finished Goods'.toUpperCase()    )
    {
        for( var j=0; j < listSize; j++ )
        {
            if( form['allwipLotsList['+j+'].checked'].checked == true )
            {
                if (form['allwipLotsList['+j+'].splitLotOneQty'].value == '')
                {
                    form['allwipLotsList['+j+'].splitLotOneQty'].focus();
                    pa.innerHTML = "<li>Please Enter splitLotOne Quantity In</li>";
                    form['allwipLotsList['+j+'].splitLotTwoQty'].value = '';
                    return;
                }
                else if (parseInt(form['allwipLotsList['+j+'].splitLotOneQty'].value ) == 0 )
                {
                    form['allwipLotsList['+j+'].splitLotOneQty'].focus();
                    pa.innerHTML = "<li>Zero value is not permitted for Quantity In, Please enter greater than Zero</li>";
                    form['allwipLotsList['+j+'].splitLotTwoQty'].value = '';

                    return;
                }
                else if (  parseInt ( form['allwipLotsList['+j+'].splitLotOneQty'].value ) >= parseInt ( form['allwipLotsList['+j+'].dieQtyIn'].value, 10 )   )
                {
                    pa.innerHTML = "<li>SplitLot one Qty cannot be greater or equal than Die Qty In </li>";
                    form['allwipLotsList['+j+'].splitLotTwoQty'].value = '';
                    form['allwipLotsList['+j+'].splitLotOneQty'].focus();
                    return;
                }
                else if( form['allwipLotsList['+j+'].comments'].value.trim().length > 1000 )
                {
                    pa.innerHTML = "<li>Comments should not be greater than 1000 characters";
                    form['allwipLotsList['+j+'].comments'].focus();
                    return;
                }

                count1 = count1+1;
            }
        }
    }
    else
    {
        for( var i=0; i < listSize; i++ )
        {
            if( form['allwipLotsList['+i+'].checked'].checked == true )
            {
                if (form['allwipLotsList['+i+'].splitLotOneQty'].value == '')
                {
                    form['allwipLotsList['+i+'].splitLotOneQty'].focus();
                    pa.innerHTML = "<li>Please Enter splitLotOne Quantity In</li>";
                    form['allwipLotsList['+i+'].splitLotTwoQty'].value = '';
                    form['allwipLotsList['+i+'].splitLotOneWaferIds'].value = '';
                    form['allwipLotsList['+i+'].splitLotTwoWaferIds'].value = '';
                    return;
                }
                else if (parseInt(form['allwipLotsList[0].splitLotOneQty'].value ) == 0 )
                {
                    form['allwipLotsList['+i+'].splitLotOneQty'].focus();
                    pa.innerHTML = "<li>Zero value is not permitted for Quantity In, Please enter greater than Zero</li>";
                    form['allwipLotsList['+i+'].splitLotTwoQty'].value = '';
                    form['allwipLotsList['+i+'].splitLotOneWaferIds'].value = '';
                    form['allwipLotsList['+i+'].splitLotTwoWaferIds'].value = '';
                    return;
                }
                else if (  parseInt ( form['allwipLotsList['+i+'].splitLotOneQty'].value ) >= parseInt ( form['allwipLotsList['+i+'].waferQtyIn'].value, 10 )   )
                {
                    pa.innerHTML = "<li>SplitLot one Qty cannot be greater or equal than Wafer Qty In </li>";
                    form['allwipLotsList['+i+'].splitLotTwoQty'].value = '';
                    form['allwipLotsList['+i+'].splitLotOneWaferIds'].value = '';
                    form['allwipLotsList['+i+'].splitLotTwoWaferIds'].value = '';
                    form['allwipLotsList['+i+'].splitLotOneQty'].focus();
                    return;
                }
                else if( form['allwipLotsList['+i+'].comments'].value.trim().length > 1000 )
                {
                    pa.innerHTML = "<li>Comments should not be greater than 1000 characters";
                    form['allwipLotsList['+i+'].comments'].focus();
                    return;
                }
                count1 = count1+1;

            }
        }
    }

    if( count1==0 )
	{
		pa.innerHTML = "<li> Please select atleast one lot";
		return;
	}

    enableFields( form );
    form.action.value="save";
    form.submit();
}

function enableFields( form )
{
    for( var j=0; j < listSize; j++ )
    {
       if( form['allwipLotsList['+j+'].checked'].checked == true )
        {
            if ( form['allwipLotsList['+j+'].waferIds'] != null )
            {
                form['allwipLotsList['+j+'].waferIds'].disabled            = false;
                form['allwipLotsList['+j+'].waferQtyIn'].disabled          = false;
                form['allwipLotsList['+j+'].splitLotOne'].disabled         = false;
                form['allwipLotsList['+j+'].splitLotTwo'].disabled         = false;
                form['allwipLotsList['+j+'].splitLotTwoQty'].disabled      = false;
                form['allwipLotsList['+j+'].splitLotOneWaferIds'].disabled = false;
                form['allwipLotsList['+j+'].splitLotTwoWaferIds'].disabled = false;
            }
            else
            {
                form['allwipLotsList['+j+'].splitLotOne'].disabled        = false;
                form['allwipLotsList['+j+'].splitLotTwo'].disabled        = false;
                form['allwipLotsList['+j+'].dieQtyIn'].disabled           = false;
                form['allwipLotsList['+j+'].splitLotTwoQty'].disabled     = false;
            }
        }
    }
}

function productSelected(form)
{
    var pa=document.getElementById("message");
    var x = form.processStepId;

    for(var i=0; i< x.length; i++)
    {
        if(x.options[i].selected)
        {
	        if(x.options[i].value == "0")
            {
	            pa.innerHTML = "<li>Select Product Name</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function lotNoSelected(form)
{

    var pa=document.getElementById("message");
    var x = form.lotId;

    for(var i=0; i< x.length; i++)
    {
        if(x.options[i].selected)
        {
	        if(x.options[i].value == "0")
            {
	            pa.innerHTML = "<li>Select Lot Number</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function isValidInteger(temp)
{
    errors = "";
    var pa=document.getElementById("message");

    if(!isInteger(temp.value))
    {
        errors = "<li>Please enter a valid integer</li>";
        pa.innerHTML = errors;
        temp.focus();
        return false;
    }

    return true;
}

function locationSelected(form)
{
    var pa=document.getElementById("message");
    var x = form.locationId;

    for(var i=0; i< x.length; i++)
    {
        if(x.options[i].selected)
        {
	        if(x.options[i].value == "0")
            {
	            pa.innerHTML = "<li>Select Location</li>";
                x.focus();
	            return false;
            }
        }
    }
    return true;
}

function invWaferDataEntry( rowIndex )
{
    var pa=document.getElementById("message");
	pa.innerHTML = '';
    var form = document.lotSplitform;

    if( form['allwipLotsList['+rowIndex+'].checked'].checked == true )
    {
         var splitLotOnewaferQtyInCtrl = form['allwipLotsList['+rowIndex+'].splitLotOneQty'];

        if ( splitLotOnewaferQtyInCtrl.value.trim() == '' )
        {
            pa.innerHTML = "<li>Wafer Split Lot One Qty cannot be blank</li>";
            form['allwipLotsList['+rowIndex+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+rowIndex+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+rowIndex+'].splitLotTwoWaferIds'].value = '';
            splitLotOnewaferQtyInCtrl.focus();
            return;
        }
        if ( !isInteger( splitLotOnewaferQtyInCtrl.value ) )
        {
            pa.innerHTML = "<li>Please enter valid Wafer Quantity In , Wafer Quantity In must be number</li>";
            splitLotOnewaferQtyInCtrl.focus();
            return;
        }

        if ( parseInt (splitLotOnewaferQtyInCtrl.value, 10 ) == 0 )
        {
            pa.innerHTML = "<li>Zero value is not permitted for Wafer Quantity In, Please enter greater than Zero</li>";
            form['allwipLotsList['+rowIndex+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+rowIndex+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+rowIndex+'].splitLotTwoWaferIds'].value = '';
            splitLotOnewaferQtyInCtrl.focus();

            return;
        }

        if ( parseInt ( splitLotOnewaferQtyInCtrl.value, 10 ) > 25 )
        {
            pa.innerHTML = "<li>Wafer Quantity In cannot be greater than 25</li>";
            splitLotOnewaferQtyInCtrl.focus();
            return;
        }
        if ( parseInt ( splitLotOnewaferQtyInCtrl.value.value, 10 ) > parseInt ( form['allwipLotsList['+rowIndex+'].waferQtyIn'].value ) )
        {
            pa.innerHTML = "<li>Wafer Quantity In cannot be greater than Wafer Qty In </li>";
            splitLotOnewaferQtyInCtrl.focus();
            return;
        }
    }

    newWindow = window.open('<%=chipTracContext%>/jsp/operations/split_wafer_data_entry.jsp?waferQty='+splitLotOnewaferQtyInCtrl.value + '&rowIndex=' + rowIndex , 'SplitWaferPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=375,resizable=yes');
    newWindow.focus();
}

function showWaferInfo( rowIndex )
{
    var form = document.lotSplitform;
    var value = "view";
    var splitLotOnewaferQtyInCtrl = form['allwipLotsList['+ rowIndex+'].waferQtyIn'];
    
    newWindow = window.open('<%=chipTracContext%>/jsp/operations/split_wafer_data_entry.jsp?waferQty='+splitLotOnewaferQtyInCtrl.value + '&rowIndex=' + rowIndex + '&type=' + value  , 'SplitWaferViewPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=375,resizable=yes');
    newWindow.focus();
}

function checkLength(element, size)
{
    if(	element.value.length >= size )
	{
		event.returnValue = false;
	}
}

function enableSplitQtyOneField( index )
{
    var pa=document.getElementById("message");

    pa.innerHTML                = '';
    var form                    = document.lotSplitform;

    if( form['allwipLotsList['+index+'].checked'].checked == true )
    {
        form['allwipLotsList['+index+'].splitLotOneQty'].disabled = false;
        form['allwipLotsList['+index+'].splitLotOneQty'].focus();
    }
    else
    {
        form['allwipLotsList['+index+'].splitLotOneQty'].disabled = true;
        form['allwipLotsList['+index+'].splitLotOneQty'].value = '';
        form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
    }
}
function calculateSplitWaferQty( index )
{

    var pa=document.getElementById("message");
	pa.innerHTML = '';
    var form = document.lotSplitform;

    if( form['allwipLotsList['+index+'].checked'].checked == true )
    {
        var waferQtyInCtrl = form['allwipLotsList['+index+'].waferQtyIn'];
        var waferIdCtrl    = form['allwipLotsList['+index+'].waferIds'];
        var splitLotOneWaferIdsCtrl  = form['allwipLotsList['+index+'].splitLotOneWaferIds'];
        var splitLotTwoWaferIdsCtrl  = form['allwipLotsList['+index+'].splitLotTwoWaferIds'];
        var waferIdsValue           = waferIdCtrl.value;

        if ( eval(waferIdsValue.lastIndexOf(";") + 1 ) == waferIdsValue.length )
        {
             waferIdsValue = waferIdsValue.substring(0, eval(waferIdsValue.length-1));
        }
        var waferIdsArray      = waferIdsValue.split(";");

        if(isValidInteger( form['allwipLotsList['+index+'].splitLotOneQty'] )== false)
        {
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
        if ( form['allwipLotsList['+index+'].splitLotOneQty'].value.trim() == '' )
        {
            pa.innerHTML = "<li>Wafer Split Lot One Qty cannot be blank</li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotTwoWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
        if ( parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value, 10 ) == 0 )
        {
            pa.innerHTML = "<li>Zero value is not permitted for SplitLot one Qty, Please enter greater than Zero</li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotTwoWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }

        if ( parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value, 10 ) > 25 )
        {
            pa.innerHTML = "<li>SplitLot one Qty cannot be greater than 25</li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotTwoWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
        if (  parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value ) >= parseInt ( waferQtyInCtrl.value, 10 )   )
        {
            pa.innerHTML = "<li>SplitLot one Qty cannot be greater or equal than Wafer Qty In </li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotTwoWaferIds'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }

        var splitLotOnewaferIds = "";
        var splitLotTwowaferIds = "";

        if( form.baseprocessType.value.toUpperCase() == "FAB" || form.baseprocessType.value.toUpperCase() == "WAFER STORE" || form.baseprocessType.value.toUpperCase() == "SORT"
               /* || form.baseprocessType.value.toUpperCase() == 'DIE BANK'*/)
        {
            if( waferQtyInCtrl.value != ''  && parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value, 10 ) != 0 )
            {
                form['allwipLotsList['+index+'].splitLotTwoQty'].value = eval( waferQtyInCtrl.value - form['allwipLotsList['+index+'].splitLotOneQty'].value );

                for ( var i = 0; i < waferIdsArray.length; i++ )
                {
                    if ( waferIdsArray[i] != null && waferIdsArray[i] != '' )
                    {
                        if( i < eval(form['allwipLotsList['+index+'].splitLotOneQty'].value) )
                        {
                            splitLotOnewaferIds = splitLotOnewaferIds + ( waferIdsArray[i] ) + ";" ;
                        }
                        else
                        {
                            splitLotTwowaferIds = splitLotTwowaferIds + ( waferIdsArray[i] ) + ";" ;
                        }
                    }
                }

                splitLotOneWaferIdsCtrl.value = splitLotOnewaferIds;
                splitLotTwoWaferIdsCtrl.value = splitLotTwowaferIds;
            }
        }
    }

 }

 function calculateSplitDieQty( index )
{
    var pa=document.getElementById("message");
	pa.innerHTML = '';
    var form = document.lotSplitform;

    if( form['allwipLotsList['+index+'].checked'].checked == true )
    {
        if(isValidInteger( form['allwipLotsList['+index+'].splitLotOneQty'] )==false)
        {
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
         if ( form['allwipLotsList['+index+'].splitLotOneQty'].value.trim() == '' )
        {
            pa.innerHTML = "<li>SplitLot One Qty cannot be blank</li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
        if ( parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value, 10 ) == 0 )
        {
            pa.innerHTML = "<li>Zero value is not permitted for SplitLot one Qty, Please enter greater than Zero</li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }
        if (  parseInt ( form['allwipLotsList['+index+'].splitLotOneQty'].value ) >= parseInt ( form['allwipLotsList['+index+'].dieQtyIn'].value, 10 )   )
        {
            pa.innerHTML = "<li>SplitLot one Qty cannot be greater or equal than Die Qty In </li>";
            form['allwipLotsList['+index+'].splitLotTwoQty'].value = '';
            form['allwipLotsList['+index+'].splitLotOneQty'].focus();
            return;
        }

        if( form['allwipLotsList['+index+'].dieQtyIn'].value != '' )
        {
             form['allwipLotsList['+index+'].splitLotTwoQty'].value = eval( form['allwipLotsList['+index+'].dieQtyIn'].value - form['allwipLotsList['+index+'].splitLotOneQty'].value)
        }
    }
  }

function searchLots()
{
    var form = document.lotSplitform;

    form.action.value="partNumbers";
    form.submit();

}

</script>
<!-- Top Header Start-->
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation start -->
 <%--<%@ include file="/jsp/operations/dataentryMenu.jsp" %>--%>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/operations/dataentryMenu.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/operations/ext_user_dataentryMenu.jsp" %>
    </logic:notEqual>

<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">
<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<html:form name="lotSplitform" type="com.scalar.chiptrack.operations.dataentry.lotSplit.forms.LotSplitForm" action="/lotSplit" >
<input type="hidden" name="action" value="<%= (String)request.getAttribute("action")%>">
<TABLE border="0" width="100%" align=center>
<TR><TD colspan=5 class="NArialW" align="center">Lot Split</TD><TD width="25%" class="NArialL">&nbsp;</TD></TR>
<TR><TD colspan=6 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></strong></TD></TR>
<TR><TD colspan=5>
  <chiptrack:info styleClass="NArialL" />
  <chiptrack:errors styleClass="NArialL" />
  <chiptrack:messages type="info" styleClass="NArialL" />
</TD><TD width="25%" class="NArialL">&nbsp;</TD></TR>
<logic:equal name="showMessage" value="TRUE">
    <tr><td colspan=6 align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></TD></TR>
</logic:equal>

<TR><TD>
<TABLE  border="0" width="100%" cellpadding="1" cellspacing="1">
    <TR>
        <logic:present name="processTypeList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
            <TD width="15%" nowrap class="NArialL">Process Type:<font color= "red">*</font></TD>
            <TD width="25%" class="NArialL">
            <html:select property="processType" name="lotSplitform" styleClass="txfield" onchange="selectProcessType()" >
            <html:option value="0">Select Process Type</html:option>
            <html:options collection="processTypeList" property="value" labelProperty="label"/>
            </html:select>
            <html:hidden property="baseprocessType" name="lotSplitform"/>    
            </TD>
        </logic:present>
        <logic:notPresent name="processTypeList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="25%" class="NArialL">&nbsp;</TD>
        </logic:notPresent>

      <TD width="15%" class="NArialL">&nbsp;</TD>
      <TD width="15%" class="NArialL">&nbsp;</TD>
      <TD width="15%" class="NArialL">&nbsp;</TD>
    </TR>

    <TR>
        <TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
    </TR>

    <logic:present name="partNumbersList" >
        <TR>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD class="NArialL" width='15%'>Quick Search:</TD>
            <td class="NArialL" width='25%'>
            <input type="text" name="qs1" class="txfield" size='23' onkeyup='quickSearch(qs_1)'/>
            </td>
            <TD COLSPAN=3>&nbsp;</TD>
        </TR>
    </logic:present>

    <TR>
        <logic:present name="partNumbersList" >
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">Product Name: </TD>
            <TD width="25%" class="NArialL">
                <html:select property="processStepId"  name="lotSplitform" styleClass="txfield">
                <html:option value="0">Select Part Number</html:option>
                <html:options collection="partNumbersList" property="value" labelProperty="label"/>
                </html:select>
            </TD>
        </logic:present>
        <logic:notPresent name="partNumbersList" scope="request">
             <TD width="15%" class="NArialL">&nbsp;</TD>
             <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="25%" class="NArialL">&nbsp;</TD>
        </logic:notPresent>

        <logic:present name="locationList" scope="request">
            <TD align="center" width="15%"><font class="NArialL">Location:</font></TD>
            <TD align="left" width="15%" class="NArialL">
                <html:select property="locationId" name="lotSplitform" styleClass="txfield">
                    <html:options collection="locationList" property="value" labelProperty="label"/>
                </html:select>
            </TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
        </logic:present>
        <logic:notPresent name="locationList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
       </logic:notPresent>
    </TR>

    <TR>
          <TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
     </TR>

    <logic:present name="splitLotNoList" scope="request">
        <TR>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD class="NArialL" width='15%'>Quick Search:</TD>
            <td class="NArialL" width='25%'>
            <input type="text" name="qs2" class="txfield" size='23' onkeyup='quickSearch(qs_2)'/>
            </td>
            <TD COLSPAN=3>&nbsp;</TD>
        </TR>
    </logic:present>
    <TR>
        <logic:present name="splitLotNoList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">Lot Number:</TD>
            <TD width="25%" class="NArialL">
            <html:select property="lotId" name="lotSplitform" styleClass="txfield" >
                    <html:option value="0">Select Lot  Number</html:option>
                    <html:options collection="splitLotNoList" property="lotId" labelProperty="lotNumber"/>
            </html:select>
            </TD>
        </logic:present>
        <logic:notPresent name="splitLotNoList" scope="request">
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="15%" class="NArialL">&nbsp;</TD>
            <TD width="25%" class="NArialL">&nbsp;</TD>
        </logic:notPresent>

      <TD width="15%" class="NArialL">&nbsp;</TD>
      <TD width="15%" class="NArialL">&nbsp;</TD>
      <TD width="15%" class="NArialL">&nbsp;</TD>

    </TR>

    <TR>
         <TD colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></TD>
    </TR>

   <logic:present name="partNumbersList">
   <TR>
        <TD width="5%" class="NArialL">&nbsp;</TD>
        <td colspan="5" align="center">
            <a href="javascript:searchLots()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search for Inventory Receive Lots';return true" onmouseout="window.status='';return true"title="Click to Search for Inventory Receive Lots"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="javascript:reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
        </td>
        <TD COLSPAN=1>&nbsp;</TD>
    </TR>
   </logic:present>
    </TABLE>
   </TD>
 </TR>
</TABLE>

<nested:present property="allwipLotsList">
   <nested:size id="LotsSize"property="allwipLotsList"/>
   <logic:greaterThan name="LotsSize" value="0">
   <%--
   <TR>
       <TD colspan="5" >--%>
           <table width="100%" align="left" cellpadding="1" cellspacing="1" border="0">
               <tr>
               <td colspan="12"class='NArialL'><font class='NArialS'><font color='blue'>[Click on Select checkbox to Split the Lots]</font></font></td>
           </tr>
           <tr bgcolor="#993333" align = "center">
               <td width="2%"  class='NArialL'><font color="#FFFFFF">Select </font></td>
               <td width="15%" class='NArialL' nowrap><font color="#FFFFFF">Part Number</font></td>
               <td width="12%" class='NArialL' nowrap><font color="#FFFFFF">Lot No#</font></td>
               <td width="10%" class='NArialL' nowrap><font color="#FFFFFF">QtyIn</font></td>
               <logic:equal name="showWaferIds" value="TRUE">
               <td width="5%"  class='NArialL' nowrap><font color="#FFFFFF">WaferIds</font></td>
               </logic:equal>
               <td width="10%" class='NArialL' nowrap><font color="#FFFFFF">Lot1</font></td>
               <td width="10%" class='NArialL'><font color="#FFFFFF">Lot2</font></td>
               <td width="8%"  class='NArialL'><font color="#FFFFFF">Lot1 Qty<font color= "red">*</font></font></td>
               <td width="8%" class='NArialL'><font color="#FFFFFF">Lot2 Qty</font></td>
              <logic:equal name="showWaferIds" value="TRUE">
               <td width="10%"  class='NArialL'><font color="#FFFFFF">Lot1 WaferIds</font></td>
               <td width="10%" class='NArialL'><font color="#FFFFFF">Lot2 WaferIds</font></td>
               </logic:equal>
               <td width="10%" class='NArialL'><font color="#FFFFFF">Comments</font></td>
          </tr>
            <nested:size id="listSize" property="allwipLotsList"/>
           <nested:iterate id="wipInfo" property="allwipLotsList" indexId="iterateIdx" type = "com.scalar.chiptrack.operations.dataentry.LotDetails">
           <% String click = "enableSplitQtyOneField('"+iterateIdx.intValue()+"')";
              String calWaferQty = "calculateSplitWaferQty('"+iterateIdx.intValue()+"')";
              String calDieQty = "calculateSplitDieQty('"+iterateIdx.intValue()+"')";%>

           <tr bgcolor='<%=iterateIdx.intValue() % 2 == 0 ? "#FFFFEE" : "#DEE1E2"%>'>
               <td width ="3%" align="center" ><font class='NArialL'><nested:checkbox  name="wipInfo" property = "checked" onclick="<%= click %>"/></font></td>
               <td><font class='NArialL'><nested:write name="wipInfo" property ="partNumber"/></font></td>
               <td><font class='NArialL'><nested:write name="wipInfo" property ="lotNumber"/></font></td>
               <logic:equal name="showWaferIds" value="TRUE">

               <td><font class='NArialL'><nested:write name="wipInfo" property ="waferQtyIn"/> <nested:hidden name="wipInfo" property="waferIds"/><nested:hidden name="wipInfo" property="waferQtyIn"/></font></td>
               <td><font class='NArialL'><a href="javascript:showWaferInfo('<%= iterateIdx.intValue() %>')" onmouseover="window.status='Click here to view the Wafer Id Info';return true" onmouseout="window.status='';return true" title="">Wafers</a></font></td>
               </logic:equal>
               <logic:notEqual name="showWaferIds" value="TRUE">
               <td><font class='NArialL'><nested:write name="wipInfo" property ="dieQtyIn"/></font></td><nested:hidden name="wipInfo" property="dieQtyIn"/>
               </logic:notEqual>
               <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotOne" styleClass="txfield" size="18" maxlength="30"  disabled="true"/></font></td>
               <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotTwo" styleClass="txfield" size="18" maxlength="30"  disabled="true"/></font></td>
               <logic:equal name="showWaferIds" value="TRUE">
                <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotOneQty" styleClass="valuetxfield" onkeypress="allowInteger()" onchange="<%= calWaferQty %>" size="8" maxlength="20" disabled="true"/></font></td>
               </logic:equal>
               <logic:notEqual name="showWaferIds" value="TRUE">
                <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotOneQty" styleClass="valuetxfield" onkeypress="allowInteger()" onchange="<%= calDieQty %>" size="8" maxlength="20" disabled="true"/></font></td>
              </logic:notEqual>
               <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotTwoQty" styleClass="valuetxfield"  size="8" maxlength="20" disabled="true"/></font></td>
               <logic:equal name="showWaferIds" value="TRUE">
               <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotOneWaferIds" styleClass="txfield" size="25" maxlength="100" disabled="true"/><a href="javascript:invWaferDataEntry('<%= iterateIdx.intValue() %>')" onmouseover="window.status='Click here to Change the Wafer Id Info';return true" onmouseout="window.status='';return true" title=""><IMG border="0" src="<%=chipTracContext%>/jsp/includes/images/uparrow.gif" width="20" height="16"></a></font></td>
               <td><font class='NArialL'><nested:text name="wipInfo" property="splitLotTwoWaferIds" styleClass="txfield" size="25" maxlength="100" disabled="true"/></font></td>
               </logic:equal>
               <td><font class='NArialL'>
                   <nested:textarea name="wipInfo" property="comments" onkeypress="javascript:checkLength(this, 1000)" styleClass="txfield" rows="2" cols="20"/>
               </font>
               </td>

           </tr>
            </nested:iterate>
            <script type="text/javascript">
               listSize = <%=listSize.intValue()%>;
            </script>
            <TR>
               <TD COLSPAN="12"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/spacer.gif" HEIGHT=20></TD>
           </TR>
           <tr>
              <td align = "center" colspan ="12">
                   <a href="javascript:finalSave()" onmouseover="window.status='Click here to Save the Split Lots';return true" onmouseout="window.status='';return true" title="Click here to Save the Split Lots"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                   <a href="javascript:reset()" onmouseover="window.status='Click here to Reset the Split Lots';return true" onmouseout="window.status='';return true" title="Click here to Reset the Split Lots"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
               </td>
           </tr>
             </table>
        <%--   </TD>
      </TR>--%>

   </logic:greaterThan>
   </nested:present>

</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

<%--
<%
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
%>--%>
